#!/usr/bin/python3

from PIL import Image, ImageDraw, ImageFont, ImageSequence
import time
import random
import led_driver

led_driver.Open(5000000)

led_driver.SetGlobalBright(2)

image = Image.new('RGB', (32, 16))
draw = ImageDraw.Draw(image)

while 1:
	image = Image.new('RGB', (32, 16))
	draw = ImageDraw.Draw(image)
	# 随机星点、颜色、10个以内
	count = random.randrange(1, 30)
	for i in range(count + 1):
		x = random.randrange(0, 32)
		y = random.randrange(0, 16)
		c_r = random.randrange(0, 256)
		c_g = random.randrange(0, 256)
		c_b = random.randrange(0, 256)

		draw.point([(x, y)], fill = (c_r, c_g, c_b))

	led_driver.Display(image.tobytes())

	time.sleep(2)

